<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>新闻详情</title>
	<link rel="shortcut icon" href="../img/title/招聘求职.png" type="image/x-icon">
	<!-- 引入样式 -->
	<link rel="stylesheet" href="../css/news_detail.css">
	<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
	<div id="app">
		<div class="header">
			<div class="header_left">
				<img src="../img/main/招聘会.png"	>
				<a href="./main.html">&nbsp;校园兼职管理</a>
			</div>
			<div class="header_center">
				<ul>
					<li ><a href="./main.html">主页</a></li>
					<li><a href="./work_list.html">职位</a></li>
					<li><a style="color: lawngreen;" href="./news.html">校园新闻</a></li>
				</ul>
			</div>
			<div class="header_right">
				<el-button @click="loginBtn" type="success" icon="el-icon-user-solid">登录</el-button>
				<el-button @click="registerBtn" type="success" icon="el-icon-takeaway-box">注册</el-button>
			</div>
		</div>
		<div class="section">
			<div class="section_1">校园新闻</div>
			<div class="section_2">首页 > 校园新闻 > 新闻详情</div>
		</div>
		<div class="news_detail">
			<div class="news_detail_btn">
				<el-link :href="path" target="_self" type="primary"><i class="el-icon-caret-left"></i>返回上一级</el-link>
			</div>
			<div class="news_detail_content">
				<div class="news_detail_content_header"><h1>{{this.dataList.news_name}}</h1></div>
				<div class="news_detail_content_content">
					
					<br>&nbsp;&nbsp;&nbsp;&nbsp;{{this.dataList.news_content}}
				</div>
				
				<div class="news_detail_content_footer"><h2>发布人:{{this.dataList.news_issuer}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发布时间: {{this.dataList.news_time}}</h2></div>
			</div>
		</div>
	</div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script src="../js/jquery-3.6.1.js"></script>
<script src="../js/after_landing.js"></script>
<script>
	const vm = new Vue({
		el: '#app',
		data(){
			return {
				dataList : [],
				path: '',
				userMsgList : [],
			}
		},
		created(){
			let id = window.sessionStorage.getItem('id');
			this.path = window.sessionStorage.getItem('path')
			axios.get("/news/"+id).then((resp)=>{
				this.dataList = resp.data.data;
			})
			let username = getCookie("cookie_username")
			if (username !== null && username.length > 0){
				axios.get('/users/'+username).then((resp)=>{
					this.userMsgList = resp.data.data
					$('.header_center ul').append(`<li><a href="./personal_resume.html">简历</a></li>`)
					$('.header_center ul').append(`<li><a href="./personal_center.html">个人中心</a></li>`)
					$('.header_right').empty()
					let url = this.userMsgList.user_image
					$(".header_right").append(`<img style="width: 7%;margin-right: 5px" src="${url}">${username}`);
					$(".header_right").append(`<a style="text-decoration: none;color: #77838e;margin-left: 5px" href="/logins/logout">注销</a>`);
				})
			} else {
				$('.header_center ul li:gt(2)').remove()
			}
		},
		methods:{
			loginBtn(){
				document.location.href = "login.html"
			},
			registerBtn(){
				document.location.href = "register.html"
			},
		}
	})
</script>
</html>